Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements image upload API endpoint separation with support for multiple image uploads. The changes introduce an enum-based image type system and separate API endpoints for different image upload scenarios.
- Refactored S3 service to handle multiple file uploads instead of single files
- Added ImageType enum to categorize images (ACCOMPANY, COMMUNITY, MEMBER_PROFILE)
- Created separate image upload endpoints with proper documentation and validation
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| S3Service.java | Refactored from single file to multiple file upload support with better validation |
| ImageController.java | Updated API endpoint to handle multiple files with Swagger documentation |
| Image.java | Added ImageType enum field and factory methods for different image contexts |
| AccompanyPostRequest.java | Added images field to support image uploads in accompany posts |
| MemberProfileService.java | Added profile image upload functionality |
| Various DTOs | New request/response DTOs for image handling |
| public void uploadProfileImage(@AuthenticationPrincipal CustomOAuth2User user, @RequestBody ImageRequest request){ | ||
| memberProfileService.uploadMemberProfileImage(user, request.getImageName(), request.getImageUrl()); |
There was a problem hiding this comment.
The endpoint accepts ImageRequest with imageName and imageUrl via @RequestBody, but this assumes images are already uploaded elsewhere. This is inconsistent with the main image upload endpoint which handles MultipartFile uploads. Consider using the existing /api/v1/images/upload endpoint instead or clarify the intended workflow.
| public void uploadProfileImage(@AuthenticationPrincipal CustomOAuth2User user, @RequestBody ImageRequest request){ | |
| memberProfileService.uploadMemberProfileImage(user, request.getImageName(), request.getImageUrl()); | |
| public void uploadProfileImage(@AuthenticationPrincipal CustomOAuth2User user, @RequestParam("file") MultipartFile file){ | |
| memberProfileService.uploadMemberProfileImage(user, file); |
| public static Image fromCommunity(String imageName, String imageUrl, Community community) { | ||
| return new Image(imageName, imageUrl, community, ImageType.COMMUNITY); |
There was a problem hiding this comment.
The fromCommunity factory method hardcodes ImageType.COMMUNITY instead of accepting it as a parameter like the other factory methods. This is inconsistent with fromAccompany and fromMember methods which accept ImageType as a parameter.
| public static Image fromCommunity(String imageName, String imageUrl, Community community) { | |
| return new Image(imageName, imageUrl, community, ImageType.COMMUNITY); | |
| public static Image fromCommunity(String imageName, String imageUrl, Community community, ImageType imageType) { | |
| return new Image(imageName, imageUrl, community, imageType); |
| .anyMatch(apply -> apply.getAccompany().equals(accompany)); | ||
| if (alreadyApplied) { | ||
| throw BaseException.from(ErrorCode.TMP_ERROR); | ||
| throw BaseException.from(ErrorCode.ACCOMPANY_ALREADY_APPLIED); |
There was a problem hiding this comment.
The error code ACCOMPANY_ALREADY_APPLIED is used but this error code is not defined in the ErrorCode enum. This will cause a compilation error or runtime exception.
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.stereotype.Component; |
There was a problem hiding this comment.
[nitpick] The annotation changed from @service to @component. Since this class provides business logic for S3 operations, @service would be more semantically appropriate as it clearly indicates this is a service layer component.
| import org.springframework.stereotype.Component; | |
| import org.springframework.stereotype.Service; |
이슈
구현 기능